import type { ElementHiderRuleConfig } from '../../../types/constants'
import { ElementSelectorPosition, ElementSelectorType } from '../../../types/constants'
import { ELEMENT_IDENTIFIER_CONFIG } from '../../service/element_identifier/types'

export const JUE_JIN_WEB_ELEMENT_CONFIG: ElementHiderRuleConfig = {
  [ELEMENT_IDENTIFIER_CONFIG.default.announcement.id]: {
    hide: true,
    selectorType: ElementSelectorType.Class,
    selector: '.top-banners-container',
    position: ElementSelectorPosition.TopCenter,
  },
  [ELEMENT_IDENTIFIER_CONFIG.default.header.id]: {
    hide: true,
    selectorType: ElementSelectorType.Tag,
    selector: 'header',
    position: ElementSelectorPosition.TopCenter,
  },
  [ELEMENT_IDENTIFIER_CONFIG.default.leftAside.id]: {
    hide: true,
    selectorType: ElementSelectorType.Class,
    selector: '.article-suspended-panel',
    position: ElementSelectorPosition.MiddleLeft,
  },
  [ELEMENT_IDENTIFIER_CONFIG.ad.imageAd.id]: {
    hide: true,
    selectorType: ElementSelectorType.Complex,
    selector: 'article > img',
    position: ElementSelectorPosition.MiddleCenter,
  },
  [ELEMENT_IDENTIFIER_CONFIG.blog.codeExperienceHint.id]: {
    hide: true,
    selectorType: ElementSelectorType.Mix,
    selector: '#article-root .code-tips',
    position: ElementSelectorPosition.MiddleCenter,
  },
  [ELEMENT_IDENTIFIER_CONFIG.blog.articleHr.id]: {
    hide: false,
    selectorType: ElementSelectorType.Mix,
    selector: '#article-root hr',
    position: ElementSelectorPosition.MiddleCenter,
  },
  [ELEMENT_IDENTIFIER_CONFIG.default.selectedSearch.id]: {
    hide: false,
    selectorType: ElementSelectorType.Mix,
    selector: '.main-container .context-menu',
    position: ElementSelectorPosition.MiddleCenter,
  },
  [ELEMENT_IDENTIFIER_CONFIG.default.rightAside.id]: {
    hide: true,
    selectorType: ElementSelectorType.Id,
    selector: '#sidebar-container',
    position: ElementSelectorPosition.MiddleRight,
  },
  [ELEMENT_IDENTIFIER_CONFIG.blog.authorInfo.id]: {
    hide: true,
    selectorType: ElementSelectorType.Mix,
    selector: '#sidebar-container .author-block',
    position: ElementSelectorPosition.MiddleRight,
  },
  [ELEMENT_IDENTIFIER_CONFIG.blog.officialToc.id]: {
    hide: true,
    selectorType: ElementSelectorType.Mix,
    selector: '#sidebar-container .article-catalog',
    position: ElementSelectorPosition.MiddleRight,
  },
  [ELEMENT_IDENTIFIER_CONFIG.blog.relatedRecommend.id]: {
    hide: true,
    selectorType: ElementSelectorType.JQuery,
    selector: '#sidebar-container > div > div:has(div.block-title:contains(相关推荐))',
    position: ElementSelectorPosition.MiddleRight,
    listen: true,
  },
  [ELEMENT_IDENTIFIER_CONFIG.default.featuredContent.id]: {
    hide: true,
    selectorType: ElementSelectorType.JQuery,
    selector: '#sidebar-container > div > div:has(div.block-title:contains(精选内容))',
    position: ElementSelectorPosition.MiddleRight,
    listen: true,
  },
  [ELEMENT_IDENTIFIER_CONFIG.ad.contentAd.id]: {
    hide: true,
    selectorType: ElementSelectorType.Complex,
    selector: '#sidebar-container > div > div.ad-container',
    position: ElementSelectorPosition.MiddleRight,
  },
  [ELEMENT_IDENTIFIER_CONFIG.blog.articleComment.id]: {
    hide: true,
    selectorType: ElementSelectorType.Id,
    selector: '#comment-box',
    position: ElementSelectorPosition.BottomCenter,
  },
  [ELEMENT_IDENTIFIER_CONFIG.blog.recommendRead.id]: {
    hide: true,
    selectorType: ElementSelectorType.Class,
    selector: '.recommended-area',
    nameZh: '为你推荐',
    position: ElementSelectorPosition.BottomCenter,
  },
  [ELEMENT_IDENTIFIER_CONFIG.blog.articleEnd.id]: {
    hide: true,
    selectorType: ElementSelectorType.Class,
    selector: '.article-end',
    nameZh: '文章结束（容器）',
    position: ElementSelectorPosition.BottomCenter,
  },
  [ELEMENT_IDENTIFIER_CONFIG.default.rank.id]: {
    hide: true,
    selectorType: ElementSelectorType.Class,
    selector: '.rank-entry-bottom',
    position: ElementSelectorPosition.BottomCenter,
  },
  [ELEMENT_IDENTIFIER_CONFIG.blog.articleTag.id]: {
    hide: true,
    selectorType: ElementSelectorType.Class,
    selector: '.tag-list-box',
    position: ElementSelectorPosition.BottomCenter,
  },
  [ELEMENT_IDENTIFIER_CONFIG.blog.articleColumn.id]: {
    hide: true,
    selectorType: ElementSelectorType.Class,
    selector: '.column-container',
    position: ElementSelectorPosition.BottomCenter,
  },
  [ELEMENT_IDENTIFIER_CONFIG.default.loginModal.id]: {
    hide: true,
    selectorType: ElementSelectorType.Class,
    selector: '.bottom-login-guide',
    position: ElementSelectorPosition.BottomRight,
  },
  [ELEMENT_IDENTIFIER_CONFIG.default.rightAsideToolbar.id]: {
    hide: true,
    selectorType: ElementSelectorType.Mix,
    selector: '.global-component-box .suspension-panel',
    position: ElementSelectorPosition.BottomRight,
  },
}
